import java.util.*; import java.io.*; public class AtmCash{     public static void main(String []args){        int option, pin;        int PIN[] = {1234,2243,4564,6768,6866,6865,4345,2344,5676,9898};        float balance[] ={1000,1000,1000,1000,1000,1000,1000,1000,1000,1000};      int Account_number[] = {123456789,223435332,456765454,345433434,334432343,345678976,342234545,56454332,343343432,345434323};        int withdraw, deposit;        System.out.println("*** Welcome to ELAC ATM ***");        System.out.print("   1. Input PIN \n   2. Clear \n   3. Exit \nSelect the option : ");        Scanner sc = new Scanner(System.in);        option = sc.nextInt();      int count = 0, flag = 0;      int ch = 0;      do{op        switch(option) {        case 1: System.out.println("Enter the PIN :");                pin = sc.nextInt();                for(int i=0; i<10; i++){                if(pin == PIN[i]){               flag = 1;                    System.out.println("*** ELAC ATM System ***");                    System.out.print("   1. Withdraw Cash \n   2. Deposit \n   3. Transfer \n   4. Balance Inquiry \n   5. Logout \nChoose option : ");                    int option1 = sc.nextInt();                    switch(option1) {                        case 1: System.out.print("Enter money to be withdrawn:");                                withdraw = sc.nextInt();                                if(balance[i] >= withdraw) {                                    balance[i] = balance[i] - withdraw;                                    System.out.println("Please collect the money");                           System.exit(0);                                }                                else{                                    System.out.println("Insufficient Balance");                           System.exit(0);                        }                                  break;                        case 2: System.out.println("Enter money to be deposited:");                                deposit = sc.nextInt();                                balance[i] = balance[i] + deposit;                                System.out.println("Your Money has been successfully deposited");                        System.exit(0);                                break;                        case 3: System.out.print("Enter Account Number you wants to transfer : ");                          int acc = sc.nextInt();                        int flag1 = 0, flag2 = 0;                        for(int j=0; j<10; j++){                           if(acc == Account_number[j]){                              flag1 = 1;                                System.out.print("Enter the amount : ");                              int amount = sc.nextInt();                              if(amount < balance[i])  {                                  flag2 = 1;                                 balance[j] = balance[j] + amount;                                 balance[i] = balance[i] - amount;                                 System.out.println("Transfer Successfully");                              }                               }                        }                        if(flag2 == 0){                               System.out.println("Insufficient Balance");                              System.exit(0);                        }                            if(flag1 == 0){                              System.out.println("Invalid Account Number ");                              option = 3;                        }                                     break;                        case 4: System.out.println("Balance : "+balance[i]);                                break;                        case 5: System.exit(0);                                break;                        default : System.out.println("Invalid option");                                 break;                    }              }            }            if(flag == 0){                count++;                System.out.println("Incorrect PIN, Please try again");               if(count == 3){                  System.out.println("Too many illegal attempts, Try again later");                  System.exit(0);               }               else                   option = 1;            }                            break;        case 2: option = 1;                continue;        case 3: System.exit(0);                break;        default : System.out.println("Invalid option");                  break;        }     System.out.println(" Enter 1 to perform more operations: ");     ch = sc.nextInt();      }while(ch == 1);   } }